﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace State_2
{
    public class ForenonState : State
    {
        public override void WriteProgram(Work work)
        {
            if (work.Hour < 12)
            {
                Console.WriteLine("当前工作时间{0}点 上午", work.Hour);
            }
            else
            {
                work.SetState(new NoonState());
                work.WriteProgram();
            }
        }
    }
    public class NoonState : State
    {
        public override void WriteProgram(Work work)
        {

            if (work.Hour < 13)
            {
                Console.WriteLine("当前时间{0}点 午饭", work.Hour);
            }
            else
            {
                work.SetState(new AftrenoonState());
                work.WriteProgram();
            }
        }
    }
    public class AftrenoonState : State
    {
        public override void WriteProgram(Work work)
        {

            if (work.Hour < 17)
            {
                Console.WriteLine("当前工作时间{0}点 下午", work.Hour);
            }
            else
            {
                work.SetState(new EveningState());
                work.WriteProgram();
            }
        }
    }
    public class EveningState : State
    {
        public override void WriteProgram(Work work)
        {

            if (work.Hour < 21)
            {
                Console.WriteLine("当前工作时间{0}点 加班", work.Hour);
            }
            else
            {
                work.SetState(new SleepingState());
                work.WriteProgram();
            }
        }
    }

    public class SleepingState : State
    {
        public override void WriteProgram(Work work)
        {
            Console.WriteLine("当前工作时间{0}点 大晚上", work.Hour);
        }
    }
    public class RestSate : State
    {
        public override void WriteProgram(Work work)
        {
            Console.WriteLine("当前工作时间{0}点 下班", work.Hour);
        }
    }
}
